/****
 *  配置文件 
 */
//主机地址
var host =  "http://121.201.18.33:8088/FUNDCRM/"; 
//var host =  "http://192.168.0.107:8088/FUNDCRM/"; 

	/**  
	 * 高端
	 * @param {Object} msg 显示内容
	 * @param {Object} state 显示X 还是true勾
	 */
	function show(msg,state)
	{
		$api.text($api.byId('msg'), msg);
		if(state)
		{
			$api.removeCls($api.byId('icon'), 'aui-icon-close');
			$api.addCls($api.byId('icon'), 'aui-icon-check');
		}
		else
		{
			$api.removeCls($api.byId('icon'), 'aui-icon-check');	
			$api.addCls($api.byId('icon'), 'aui-icon-close');
		}
		$api.css($api.byId("default"),"display:block");
        setTimeout(function(){
            $api.css($api.byId("default"),"display:none");
        },2000);
	}
	
	/**
	 * 显示加载图
	 */
	function showLoading()
	{
	       $api.css($api.byId("loading"),"display:block");
	       setTimeout(function(){
	            $api.css($api.byId("loading"),"display:none");
	        },5000);
	}
	/**
	 * 隐藏加载图
	 */
	function hideLoading()
	{
	     	$api.css($api.byId("loading"),"display:none");
	}
	/**
	 * 检查是否登录
	 */
	function checkLogin()
	{
			if(!$api.getStorage('isLogin')){			
	     			api.openWin({
								name : 'login_head',
								url : '../../login/login_head.html',
								hScrollBarEnabled : false,
								slidBackEnabled : false
							});
					}
	}
	/**
	 *转换时间格式yyyy-MM-dd 
	 */
	function toDate(data) {
			var date = new Date(data);
			var y = date.getFullYear();
			var m = date.getMonth() + 1;
			m = m < 10 ? '0' + m : m;
			var d = date.getDate();
			d = d < 10 ? ('0' + d) : d;
			return y + '-' + m + '-' + d;
		}
	/**
	 *转换金钱100,000.00 
	 */
	function formatCurrency(num) {
			if (num != null && num != "") {
				num = num.toString().replace(/\$|\,/g, '');
				if (isNaN(num))
					num = "0";
				sign = (num == ( num = Math.abs(num)));
				num = Math.floor(num * 100 + 0.50000000001);
				cents = num % 100;
				num = Math.floor(num / 100).toString();
				if (cents < 10)
					cents = "0" + cents;
				for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
					num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
				return (((sign) ? '' : '-') + num + '.' + cents);
			}
		}

